 <?php
/**
 * Description of class
 *
 * @author ������
 */
abstract class LoginStrategy {

    abstract function doLogin(User $user, $auth_data);
    


    protected function _makeLogin(User $user, $data) {
        if (!$data)
            return false;
        $hash = md5(generateCode(10));
        $user->model->updateUserHashAndIP($hash, null, $data['user_id']);
        //������������� ���� � �����
        setcookie("user_id", $data['user_id'], time() + 60 * 60 * 24 * 30, "/");
        setcookie("hash", $hash, time() + 60 * 60 * 24 * 30, "/");

        $user->isLogged = true;
        $user->init((object) $data);
        return true;
    }

}
?>
